import java.util.Scanner;

public class Test {
    private static volatile int flag = 1;
    public static void main(String[] args) {
        Thread t1 = new Thread(() -> {
            while(flag == 1) {

            }
            System.out.println("hello t1");
        });

        Thread t2 = new Thread(() -> {
            Scanner scan = new Scanner(System.in);
            System.out.println("请输入falg 的数值");
            flag = scan.nextInt();
        });

        t1.start();
        t2.start();

    }
}
